<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;

class SystemNoticeAdmin extends Model
{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;


    /**
     *可批量赋值的字段
     */
    public $fillable = [
        'link_id',
        'admin_id',
        'notice_type',
        'table_data',
        'click',
        'visit',
        'visit_time',
    ];


    /**
     * 可搜索的字段
     */
    public $searchable = [
        'link_id',
        'admin_id',
        'notice_type',
        'table_data',
    ];


    /**
     * 默认倒序排序
     */
    protected $defaultSortCriteria = ['id,desc'];


    /**
     * 通知记录
     */
    public function admin(){
        return $this->belongsTo(SystemAdmin::class,'admin_id','id');
    }
}
